package com.zhongke.cotrun.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongke.cotrun.model.pojo.SignUpInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SignUpInfoMapper extends BaseMapper<SignUpInfo> {

    @Select("SELECT count(0) FROM `sign_up_info` sui,pay_order po where sui.order_code = po.order_code and po.state <3 and sui.activity_id = #{id}")
    Integer queryStock(@Param("id") Integer id);

    @Select("SELECT sui.work_unit,sui.real_name,sui.phone_number,sui.job_duties,sui.create_time " +
            "FROM `pay_order` po,pay_mall_info pmi,sign_up_info sui " +
            "where pmi.id = po.mall_id and po.order_code = sui.order_code and po.state in (1,2) and pmi.main_id = #{activitiesId}")
    List<SignUpInfo> querySignUpInfo(@Param("activitiesId") Integer activitiesId);
}
